Technical Field
The instant disclosure relates to a data storage method, in particular to a data storage method, which can be applied to a data storage system such as a hard disk.
Related Art
In recent years, the development of non-volatile storage devices, such as a solid-state drive, has been flourishing. Since storage capacity, power consumption and integration of flash memory are better than a conventional hard dish drive, flash memory has become an ideal component as a storage device in electronic devices.
A conventional flash memory includes many storage blocks for storing data, and each storage block is composed of many storage pages. After the stored data in a flash memory have been updated several times, the old data, originally stored in the storage pages, may become invalid. In this situation, it is necessary to execute garbage collection to erase invalid data, in order to release the storage pages which are occupied by the invalid data. However, the storage pages can only be re-written once the storage block is entirely and successfully erased, and the time to erase a storage block is much longer than the time to write a storage page. For example, while it may take about 200 microseconds to write a storage page, it will take about 2 milliseconds to erase a storage block. The procedure of erasing a flash memory can greatly reduce read-write performance accordingly
Furthermore, before a storage block is to be erased, the valid data in the storage block must be moved to other storage pages in a flash memory so that the storage block can then be erased. Since each storage page in a flash memory can be read/written for a limited times, moving the data will result in extra read/write, i.e., increasing the times of read/write of a storage page, thereby reducing the lifetime of a flash memory.